#include <iostream>

using namespace std;
using ll=long long;
const int N=1e5*40+10;

int a[]={
	0,5160,9191,6410,4657,7492,1531,8854,1253,4520,9231,
	1266,4801,3484,4323,5070,1789,2744,5959,9426,4433,
	4404,5291,2470,8533,7608,2935,8922,5273,8364,8819,
	7374,8077,5336,8495,5602,6553,3548,5267,9150,3309
};
int dp[N];
int main()
{
	dp[0]=1;
	int tot=0;
	for(int i=1;i<=40;i++)
	{
		tot+=a[i];
		for(int j=N;j>=0;j--)
		{
			if(j-a[i]>=0)
			{
				dp[j]|=dp[j-a[i]];
			}
		}
	}
	
	ll ret=0;
	for(int i=1;i<N;i++)
	{
		if(dp[i])
		{
			ret=max(ret,(ll)i*(tot-i));
		}
	}
	cout<<ret<<endl;
	return 0;
}
